﻿using BW.MesProject.Public.ErrorCode;
using BW.MesProject.WareHouse.Application;
using BW.MesProject.WareHouse.Domain;
using BW.MesProject.WareHouse.Infrastructure;
using BW.MesProject.WareHouse.Infrastructure.Dto.Input;
using BW.MesProject.WareHouse.Infrastructure.Dto.OutPut;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BW.MesProject.WareHouse.Host.Controllers
{
    /// <summary>
    /// 标签打印
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class LablePrintController : ControllerBase
    {
        // GET: api/<LabelPrintController>
        private readonly ILabelPrintServices LabelPrintServices;

        /// <summary>
        /// 
        /// </summary>
        /// <param name="LabelPrintServices"></param>
        public LablePrintController(ILabelPrintServices LabelPrintServices)
        {
            this.LabelPrintServices = LabelPrintServices;
        }

        /// <summary>
        /// 添加外部标签解析
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public ApiResult<int> AddLabel(LabelPrintModel model)
        {
            return LabelPrintServices.AddLabel(model);
        }
        
        /// <summary>
        /// 获取外部标签解析
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ApiResult<List<LabelPrintModel>> GetLabel([FromQuery] QryInput qryInput)
        {
            return LabelPrintServices.GetLabel(qryInput);
        }
    }
}
